import urllib2
import MySQLdb
import config
def get_data(url):
    try:
        data = urllib2.urlopen(url).read()
        return data
    except:
        return ''



def create_conn():
    conn = MySQLdb.connect (host=config.mysql_local,
                            user=config.mysql_user,
                            passwd=config.mysql_pass,
                            db=config.mysql_db,
                            port=config.mysql_port,
                            charset='utf8',
                            use_unicode=False,
                            )
    conn.autocommit(True)
    return conn
    